package com.siao.example.libaray.mvc.controller
{
	import com.siao.example.libaray.mvc.method.MVCMethod;
	import com.siao.mvc.Controller;
	import com.siao.mvc.notice.Notice;
	
	import flash.utils.setTimeout;
	
	/**
	 * MVC控制器
	 * @author SiaoLeon
	 */
	public class MVCController extends Controller
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function MVCController()
		{
			super();
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		override public function onAdd():void
		{
			this.register(MVCMethod.EXAMPLE_NOTICE, ON_EXAMPLE_Priority1, 1);
			this.register(MVCMethod.EXAMPLE_NOTICE, ON_EXAMPLE_Priority3, 3);
			this.register(MVCMethod.EXAMPLE_NOTICE, ON_EXAMPLE_Priority2, 2);
		}
		
		// -------------------------------------------------------------------------------------------------------- 函数
		
		private function ON_EXAMPLE_Priority1(notice:Notice):void
		{
			trace("Priority 1 , Params：" + notice.params);
			setTimeout(notice.complete, 1500);
		}
		
		private function ON_EXAMPLE_Priority2(notice:Notice):void
		{
			trace("Priority 2 , Params：" + notice.params);
			setTimeout(notice.complete, 2000);
		}
		
		private function ON_EXAMPLE_Priority3(notice:Notice):void
		{
			trace("Priority 3 , Params：" + notice.params);
			setTimeout(notice.complete, 1000);
		}
	
	}
}
